#!/usr/bin/python
import sys

if __name__ == '__main__':
    if len(sys.argv) < 2:
	print 'usage:<input> [extra]'
	exit(-1)
    
    if len(sys.argv) > 2:
        fp = open( sys.argv[2], 'r' )
    else:
        fp = None

    ftrain = sys.argv[1]    
    fo = open( 'features/%s.UserID' % sys.argv[1], 'w' )    
    fo.write( '6040\n' )
    for line in open( ftrain ):
        uid = int( line.split()[0] )
        if fp == None or fp.readline() != '':
            fo.write('1 %d:1\n' % uid )
        else:
            fo.write('1 %d:0\n' % uid )    
    fo.close()

    if fp != None:
        fp.close()
